# *-* coding:utf8 *-*

# 装饰器信号与槽

from PyQt5 import QtCore
from PyQt5.QtWidgets import *
import sys

class CustWidget(QWidget):
    def __init__(self,parent=None):
        super(CustWidget,self).__init__(parent)
        self.okButton = QPushButton("OK",self)
        self.okButton.setObjectName("OKbutton")
        layout = QHBoxLayout()
        layout.addWidget(self.okButton)
        self.setLayout(layout)
        QtCore.QMetaObject.connectSlotsByName(self)
        self.okButton.clicked.connect(self.on_okButton_clicked)
    
    
    def on_okButton_clicked(self):
        print("Clicked OK button")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    win = CustWidget()
    win.show()
    app.exec_()